<template>
  <div id="Productdetails">
    <el-link type="primary" class="back" @click="back">返回</el-link>
    <!-- <h3>这是产品详情页面</h3> -->
    <p>产品名称：{{ details.id }}</p>
    <p>产品价格：{{ details.name }}</p>
    <p>产品描述：{{ details.price }}</p>
    <p>产品主图：<img src="{details.category.icon}" alt=""></p>
  </div>
</template>
<script>
export default {
  data() {
    return {
      details: {}
    }
  },
  created() {
    // alert(this.$route.query.id);
    this.$axios.get('/product/findById', {
      params: {
        id: this.$route.query.id
      }
    }).then(res => {
      console.log(res)
      this.details = res.data.data
    })
  },
  methods: {
    back() {
      this.$router.back()
    }
  }
}
</script>
<style lang="scss" scoped>
    #Productdetails{
        padding: 20px;
        .back{
            font-size: 14px;
        }
    }
</style>
